	<!-- 直播方案 -->
	<template>
		<!-- listBg -->
		<view class="bg">
			<u-navbar title="直播方案" bgColor="#f9fcfe" placeholder autoBack>
				<view class="u-nav-slot" slot="right">
					<view class="closeBox dfx alc" @click="$tools.navTo('openLive/live/add')">
						新增
						<image src="/static/img/openLive/add.png" style="width: 12px;height: 12px;margin-left: 3px;" mode=""></image>
					</view>
				</view>
			</u-navbar>

			<live :height="90" :liveList="livelist" @getData="reachBottom" @edit="edit" @options="options"></live>

		</view>
	</template>

	<script>
		export default {
			data() {
				return {
					livelist: [],
					formInline: {
						page: 1,
						item: 10,
						total: 0
					},
				};
			},
			onLoad() {
				// this.getData()
			},
			onShow() {
				this.getData()
			},
			// 监听用户下拉刷新
			onPullDownRefresh() {
				this.getData()
				uni.stopPullDownRefresh()
			},
			methods: {
				reachBottom(page) {
					console.log(page);
					if (page == 0) {
						this.formInline = {
							page: 1,
							limit: 10,
							total: 0
						}
						this.getData();
					} else {
						if (this.formInline.total > this.livelist.length) {
							this.formInline.page++
							this.getData();
						}
					}
				},
				getData() {
					let params = {
						...this.formInline
					}
					this.$api.getlive(params).then(res => {
						console.log(res);
						if (res.code == 200) {
							if (this.formInline.page == 1) {
								this.livelist = res.data.list
							} else {
								this.livelist = this.livelist.concat(res.data.list)
							}
							this.formInline.total = res.data.count

						} else {
							this.$tools.toast(res.msg);
						}
					})
				},
				edit(id) {
					
					this.$tools.navTo('openLive/live/add', {
						id
					})
				},
				options(id) {
					this.$tools.navTo('openLive/live/options', {
						id
					})
				}
			}
		}
	</script>

	<style lang="less">
	</style>